package controller;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JFrame;
import javax.swing.JList;
import javax.swing.JTextPane;

import view.Modify;
/**
 * this class is to set the action listener of the button modify in the mainwindow
 * @author Estelle
 *
 */
public class modifyAction implements ActionListener {
	private JFrame mainWindow = new JFrame();
	private JTextPane message;
	private JList<String> list;
	
	public modifyAction(JFrame window, JList<String> list, JTextPane detail){
		mainWindow = window;
		this.list = list;
		message = detail;
	}
	
	@Override
    public void actionPerformed(ActionEvent event) {
        if(list.getSelectedIndex()>=0){
        		new Modify(list,mainWindow);
       }
        else message.setText(" You need to choose a contact in the list");
        	
   }
	
	


}
